/*package com.dianjing.dianqun.common.filter;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.filter.GenericFilterBean;


import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureException;

public class JwtFilter extends GenericFilterBean {

	@Override
	public void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain)
			throws IOException, ServletException {
		final HttpServletRequest request = (HttpServletRequest) req;

		final String authHeader = request.getHeader("Authorization");
		 if (authHeader == null ) {
//		if (profileActive.equals("dev") ? true : (authHeader == null)) {
			// HttpServletResponse response =(HttpServletResponse)res;
			// response.reset();
			// response.setCharacterEncoding("UTF-8");
			// response.setContentType("application/json");
			// response.getWriter().println("Missing or invalid Authorization header.");
			throw new ServletException("Missing or invalid Authorization header.");
		}

		try {
			final Claims claims = Jwts.parser().setSigningKey(TestApi.SECRETKEY).parseClaimsJws(authHeader).getBody();
			request.setAttribute("claims", claims);
		} catch (final SignatureException e) {
			throw new ServletException(e.getMessage());
		}
		chain.doFilter(req, res);
	}

}
*/